import React from 'react';
import { Modal, Button } from 'antd';
import CloseIcon from '@/components/close';
import styles from './index.module.css';

const MyModal = (props) => {
  const { children, title, onCancel, onOk, ...otherProp } = props;
  return (
    <Modal
      wrapClassName="mymodal-wrap"
      closeIcon={<CloseIcon />}
      title={<div className={styles.title}>{title}</div>}
      footer={
        <div className={styles.footer}>
          <Button
            onClick={() => {
              onCancel?.();
            }}
          >
            取消
          </Button>
          <Button
            type="primary"
            style={{ marginLeft: '8px' }}
            onClick={() => {
              onOk?.();
            }}
          >
            确定
          </Button>
        </div>
      }
      onCancel={onCancel}
      {...otherProp}
    >
      {children}
    </Modal>
  );
};

export default MyModal;
